import { $axios } from '@/utils/http';

// 首页商品推荐
export async function isPushHome(params?: RecordItem) {
  return $axios.request({
    url: 'http://localhost:8090/dyh/commodity/isPushHome',
    method: 'GET',
    params,
  });
}

// 轮播图商品推荐
export async function isPushImg(params?: RecordItem) {
  return $axios.request({
    url: 'http://localhost:8090/dyh/commodity/isPushImg',
    method: 'GET',
    params,
  });
}

// 上传图片
export async function uploadImageCommodity(params?: RecordItem) {
  return $axios.request({
    url: 'http://localhost:8090/dyh/commodity/uploadImageCommodity',
    method: 'POST',
    params,
    isFormData: true,
  });
}

// 全部商品
export async function allGoods(params?: RecordItem) {
  return $axios.request({
    url: 'http://localhost:8090/dyh/commodity/allGoods',
    method: 'GET',
    params,
  });
}

// 全部商品
export async function allGoodsByCompany(params?: RecordItem) {
  return $axios.request({
    url: 'http://localhost:8090/dyh/commodity/allGoodsByCompany',
    method: 'GET',
    params,
  });
}

// 店内热销
export async function allGoodsBySaleMonth(params?: RecordItem) {
  return $axios.request({
    url: 'http://localhost:8090/dyh/commodity/allGoodsBySaleMonth',
    method: 'GET',
    params,
  });
}

// 通过输入模糊查找
export async function selectByName(params?: RecordItem) {
  return $axios.request({
    url: 'http://localhost:8090/dyh/commodity/selectByName',
    method: 'GET',
    params,
  });
}

// 添加商品
export async function addGoods(params?: RecordItem) {
  return $axios.request({
    url: 'http://localhost:8090/dyh/commodity/addGoods',
    method: 'POST',
    params,
  });
}

// id查找商品
export async function selectGoods(params?: RecordItem) {
  return $axios.request({
    url: 'http://localhost:8090/dyh/commodity/selectGoods',
    method: 'GET',
    params,
  });
}

// 删除评论
export async function removeGoods(params?: RecordItem) {
  return $axios.request({
    url: 'http://localhost:8090/dyh/commodity/removeGoods',
    method: 'POST',
    params,
  });
}
